import React, { useEffect } from 'react'
import { useNavigate } from 'react-router-dom'
export default function Login() {
  const navigate = useNavigate()
  useEffect(() => {
    console.log('login挂载')
    return () => {
      console.log('login卸载')
    }
  }, [])
  return (
    <div>
      Login
      <button
        onClick={() => {
          setTimeout(() => {
            // 跳到首页
            navigate('/index', {
              //   replace: true, // 默认是添加历史记录,replace设置为true,就是替换历史记录
            })
            // navigate(-1)
          }, 1000)
        }}
      >
        登录
      </button>
    </div>
  )
}
